package com.java.simple.study.jvm.memstruct.methodarea;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zhoujunlin
 * @date 2021/12/12
 * @desc StringTable
 * -Xmx500m -XX:+PrintStringTableStatistics -XX:StringTableSize=桶个数（1009-MAX）
 **/
public class Demo3_5 {

    public static void main(String[] args) throws IOException {
        List<String> comeOnSword = new ArrayList<>();
        try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
                Demo3_5.class.getClassLoader().getResourceAsStream("剑来.txt")))){
            String line = null;
            long start = System.currentTimeMillis();
            while (true){
                line = bufferedReader.readLine();
                if(line == null){
                    break;
                }
                comeOnSword.add(line.intern());
            }
            System.out.println(System.currentTimeMillis() - start);
        }
    }
}
